x86: make max_mfn returned from XENMEM_machphys_mapping dynamic
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 4 Feb 2010 08:53:49 +0000 (08:53 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 4 Feb 2010 08:53:49 +0000 (08:53 +0000)
This helps debugging in the guest kernels, as then MFNs there can then
be range checked based on the reported value.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/x86/mm.c

index cab20a6f661d52893f385d0e1051c74eb2000fe7..39c665d91438582b679e59bf57ac514363d1a40c 100644 (file)
@@ -4456,12 +4456,14 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
 
     case XENMEM_machphys_mapping:
     {
-        static const struct xen_machphys_mapping mapping = {
+        struct xen_machphys_mapping mapping = {
             .v_start = MACH2PHYS_VIRT_START,
             .v_end   = MACH2PHYS_VIRT_END,
             .max_mfn = MACH2PHYS_NR_ENTRIES - 1
         };
 
+        if ( !mem_hotplug )
+            mapping.max_mfn = max_page - 1;
         if ( copy_to_guest(arg, &mapping, 1) )
             return -EFAULT;